﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CLFramework.EnvironmentCheck.CheckItems
{
    public class 检测项模板 //: ICheckItem               //todo:此处取消注释
    {
        public int Order
        {
            get { return 2; }                           //todo:显示顺序
        }

        public string Name
        {
            get { return "微软雅黑字体"; }               //todo:检测项名称
        }

        public string Remarks
        {
            get
            {
                bool ok = result;
                if (!check)
                {
                    ok = Result;
                }

                if (ok)
                    return "";                          //todo:监测成功信息
                else
                    return "请安装微软雅黑字体";         //todo:监测失败信息
            }
        }

        public bool Must
        {
            get { return true; }                        //todo:此检查项是否必须通过
        }

        private bool result = false;
        private bool check = false;
        public bool Result
        {
            get
            {
                if (!check)
                {
                    result = CheckFont("msyh.ttf");     //todo:将result设置为查询结果
                }
                return result;
            }
        }

        bool CheckFont(string fontName)
        {
            string filePath = System.IO.Directory.GetParent(System.Environment.SystemDirectory).ToString()
                + "\\Fonts\\" + fontName;
            return (System.IO.File.Exists(filePath));
        }
    }
}
